/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package enteties.article;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Joris
 */
@Entity
@Table(name = "price")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Price.findAll", query = "SELECT p FROM Price p"),
    @NamedQuery(name = "Price.findById", query = "SELECT p FROM Price p WHERE p.id = :id"),
    @NamedQuery(name = "Price.findByPurchase", query = "SELECT p FROM Price p WHERE p.purchase = :purchase"),
    @NamedQuery(name = "Price.findByCoefficient", query = "SELECT p FROM Price p WHERE p.coefficient = :coefficient"),
    @NamedQuery(name = "Price.findByDiscount", query = "SELECT p FROM Price p WHERE p.discount = :discount"),
    @NamedQuery(name = "Price.findByPrice", query = "SELECT p FROM Price p WHERE p.price = :price"),
    @NamedQuery(name = "Price.findByUpdated", query = "SELECT p FROM Price p WHERE p.updated = :updated"),
    @NamedQuery(name = "Price.findByCreated", query = "SELECT p FROM Price p WHERE p.created = :created")})
public class Price implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "purchase")
    private double purchase;
    @Basic(optional = false)
    @NotNull
    @Column(name = "coefficient")
    private double coefficient;
    @Basic(optional = false)
    @NotNull
    @Column(name = "discount")
    private double discount;
    @Basic(optional = false)
    @NotNull
    @Column(name = "price")
    private double price;
    @Column(name = "updated")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updated;
    @Column(name = "created")
    @Temporal(TemporalType.TIMESTAMP)
    private Date created;
    @JoinColumn(name = "Model_id", referencedColumnName = "id")
    @ManyToOne
    private Model modelid;
    @JoinColumn(name = "Size_id", referencedColumnName = "id")
    @ManyToOne
    private Size1 sizeid;
    @JoinColumn(name = "Article_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Article articleid;
    @JoinColumn(name = "PriceClass_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Priceclass priceClassid;

    public Price() {
    }

    public Price(Integer id) {
        this.id = id;
    }

    public Price(Integer id, double purchase, double coefficient, double discount, double price) {
        this.id = id;
        this.purchase = purchase;
        this.coefficient = coefficient;
        this.discount = discount;
        this.price = price;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public double getPurchase() {
        return purchase;
    }

    public void setPurchase(double purchase) {
        this.purchase = purchase;
    }

    public double getCoefficient() {
        return coefficient;
    }

    public void setCoefficient(double coefficient) {
        this.coefficient = coefficient;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public Model getModelid() {
        return modelid;
    }

    public void setModelid(Model modelid) {
        this.modelid = modelid;
    }

    public Size1 getSizeid() {
        return sizeid;
    }

    public void setSizeid(Size1 sizeid) {
        this.sizeid = sizeid;
    }

    public Article getArticleid() {
        return articleid;
    }

    public void setArticleid(Article articleid) {
        this.articleid = articleid;
    }

    public Priceclass getPriceClassid() {
        return priceClassid;
    }

    public void setPriceClassid(Priceclass priceClassid) {
        this.priceClassid = priceClassid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Price)) {
            return false;
        }
        Price other = (Price) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "enteties.article.Price[ id=" + id + " ]";
    }
    
}
